package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.HashMap;

/**
 * 字典明细
 */

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class SystemDictionaryItem {
    private Long id;

    // 所属目录id
    private Long parentId;

    // 标题
    private String title;

    // 序号
    private Integer sequence;

    /**
     * 将字典明细转换成json格式的数据
     *
     * @return
     */
    public String getJson() {
        HashMap<String, Object> jsonObject = new HashMap<>();
        jsonObject.put("id", this.id);
        jsonObject.put("parentId", this.parentId);
        jsonObject.put("title", this.title);
        jsonObject.put("sequence", this.sequence);
        return JSON.toJSONString(jsonObject);
    }
}